博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
HttpServletResponse encodeURL 作用
阅读量:4543 次
发布时间:2019-06-08

本文共 1031 字,大约阅读时间需要 3 分钟。

If your application uses session objects, you must ensure that session tracking is enabled by having the application rewrite URLs whenever the client turns off cookies. You do this by calling the response’s encodeURL(URL) method on all URLs returned by a servlet. This method includes the session ID in the URL only if cookies are disabled; otherwise, it returns the URL unchanged.

The doGet method of ShowCartServlet encodes the three URLs at the bottom of the shopping cart display page as follows:

 

If cookies are turned off, the session is encoded in the Check Out URL as follows:

http://localhost:8080/bookstore1/cashier;jsessionid=c0o7fszeb1

If cookies are turned on, the URL is simply

 
 
在客户端禁止cookie的情况下,将session信息追加到url后,保持session同步。

转载于:https://www.cnblogs.com/lostyue/archive/2012/03/15/2398783.html

你可能感兴趣的文章
hutacm 1465错排
查看>>
.NET开源项目
查看>>
Ceph中Bufferlist的设计与使用
查看>>
左右浮动 三列布局
查看>>
mysql replication 复制的一些问题
查看>>
华为综合面被刷,写点经验,以备后用
查看>>
F-basic资源
查看>>
django的orm框架(进阶篇)
查看>>
js实现跨平台滑动加载
查看>>
win 10 slmgr.vbs -xpr 无法运行,被豆麦笔记打开解决方法
查看>>
CYQ学习主要摘要
查看>>
04 shell编程之循环语句
查看>>
mysql性能优化-慢查询分析、优化索引和配置
查看>>
Dubbo和Spring Cloud微服务架构对比
查看>>
发现对各类项目有用的不同JavaScript的Web UI
查看>>
HTML5 Shiv – 让该死的IE系列支持HTML5吧
查看>>
JSON 之JAVA 解析
查看>>
【done】大众点评
查看>>
18.索引
查看>>
Software Testing Homework1: An error in my past program
查看>>